package com.gexiaobao.pigeon.ui.adapter

import androidx.appcompat.widget.AppCompatTextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.model.bean.THeadData
import com.gexiaobao.pigeon.databinding.ItemTitleNowGroupBinding

/**
 * @Author      : hxw
 * @Date        : 2024/7/8 15:57
 * @Describe    :
 */
class AdapterTitleNowGroup(data: ArrayList<THeadData>) :
    BaseQuickAdapter<THeadData, DataBindBaseViewHolder>(R.layout.item_title_now_group, data) {
    override fun convert(holder: DataBindBaseViewHolder, item:THeadData) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemTitleNowGroupBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动

        val tvTitleNowGroup = holder.getView<AppCompatTextView>(R.id.tvTitleNowGroup)

        when (holder.layoutPosition) {
            0 -> {
                tvTitleNowGroup.setPadding(52, 30, 0, 0)
            }

            1 -> {
                tvTitleNowGroup.setPadding(107, 30, 0, 0)
            }

            3 -> {
                tvTitleNowGroup.setPadding(75, 30, 0, 0)
            }

            else -> {
                tvTitleNowGroup.setPadding(100, 30, 0, 0)
            }
        }
    }
}